﻿using Compass.LogisticService.Domain;
using Compass.LogisticService.Domain.Entities;
using Microsoft.EntityFrameworkCore;

namespace Compass.LogisticService.Infrastructure;

public class LogisticRepository:ILogisticRepository
{
    #region ctor
    private readonly LogisticDbContext _context;
    public LogisticRepository(LogisticDbContext context)
    {
        _context = context;
    }
    #endregion

    #region ImportExportInfo
    public Task<IQueryable<ImportExportInfo>> GetImportExportInfosAsync()
    {
        return Task.FromResult(_context.ImportExportInfos.AsQueryable());
    }

    public Task<ImportExportInfo?> GetImportExportInfoByIdAsync(Guid id)
    {
        return _context.ImportExportInfos.SingleOrDefaultAsync(x => x.Id.Equals(id));
    } 
    #endregion
}